After several days of trial use, please register your copy by sending $15 to the author. In return, I will provide you with information about additional features, a mini-tutorial on NewtonScript, sample sources, and priority in responding to requests.
Please continue reading for help, examples, warnings and other information.
Stephen Weyer
17 Timber Knoll Drive
Washington Crossing, PA 18977
America Online: SteveWeyer
AppleLink: WEYER.S
Internet: weyer@guest.apple.com
Revision History
1.1 (11/24/93):
• saves Newt methods, screen snapshots and evaluation results as “newts” (notes) in Notepad, organized via the built-in filing categories
• sends messages to single newt or to many newts
• adds a Print? option, with results and errors printed to a popup scrolling Print Results View
• eliminates the “do you want to add...” prompts during keyboard entry
• streamlines NewtonScript editing via inserting code templates in Define Method View and via selecting entire sample expressions for Eval
• recognizes line gesture to set Newt heading and to draw lines; drag to move Newt
• draws more cleanly (clipping, refresh); adds “poof” animation for erase
• simplifies interface for editing methods; scrolls methods
• traps and reports errors
• removes Preferences entry when Newt application is removed
1.0 (10/12/93)
• initial release
Introduction
Learners or Programmers?
You can use Newt as
• an expensive “etch-a-sketch”
• a Logo-like graphics environment
• an introduction to NewtonScript and object-oriented programming
• an introduction to creating simple views and applications — not! (but perhaps eventually)
You can get started by trying some of the simple examples outlined under Quick Tour.
Newt vs. Turtle
“Newton Turtle” and “NewtTurtle” seemed a bit too long, so I decided to shorten its name to Newt, especially given its amphibious similarity to its Logo cousin. So that Newt can appeal to many families and orientations, it is gender “newtral” (in order to reproduce more Newts, however, it has not been “newtered”); users should probably not call themselves “newtists”.
Newt vs. Notepad
Another name for Newt could have been “NewtPad” given its use of the Notepad application for viewing, printing, etc. of “newt notes” (methods and screens) or “newts” for short. One might imagine a future Newt as just a smart drawing button available on the standard Notepad. In the meanwhile, Newt is a separate application.
NewtonScript (NS) vs. Logo
Familiarity with Logo concepts and turtles would be useful in the care and feeding of Newt. However, Newt does not “speak” Logo. In addition to using buttons and gestures, you can command Newt via NewtonScript (NS), which is Newton’s built-in, object-oriented (o-o) language. NS shares ancestry with dynamic o-o languages like Smalltalk, Self, Common Lisp, and ObjectLogo. For more advanced users, familiarity with o-o concepts and constructs would be useful; for others, Newt should serve as a brief introduction to these ideas. Despite syntactic differences with Logo, you can borrow ideas and translate code from Logo materials and books, e.g., Abelson & diSessa, books on fractals, etc.
Newt vs. Newton ToolKit (NTK)
Newt allows you to write your own expressions and methods, and execute them directly on your Newton. It does not (currently) provide the ability to create dynamic views or stand-alone applications like the complete desktop-based Newton ToolKit (NTK) from Apple. Since I provide little description of Newton syntax, other functions, or curriculum ideas in this introductory file, I strongly recommend that you stay reasonably close to the examples that I provide, register Newt with me to obtain a more detailed manual and sample sources, wait for NS books to be published, and/or buy the NTK and docs from APDA for $795.
Programming WARNING
There is a benefit vs. risk trade-off here. Exploring “mathematics microworlds” and doing problem solving by writing programs are “powerful ideas” (Seymour Papert). At the same time, “a little learning [about programming] is a dangerous thing” (with apologies to Alexander Pope). Though unlikely, you could, through careless experimentation with Newt, mess up the innards of your Newton by running functions or methods blindly, removing “soups”, zapping “frames”, etc.
If you exercise some common sense, and stay within the commands and syntax I have suggested, I hope you have many hours of learning enjoyment. What’s life without a little risk anyway? At the same time, given the litigious nature of our society that yearns for risk without responsibility, I feel compelled to add the following warning (repeated in other variations several places later):
>>> WARNING: USE THIS PACKAGE AT YOUR OWN RISK! <<<
Shareware vs. Freeware
Newt is my first shareware offering; earlier, I distributed a freeware game “PicoFermiBagels”. I debated whether to cripple this version by not allowing you to save any or many methods or to automatically quit after awhile if you hadn’t registered, but I decided that I'd rather spend my time figuring out how to enable rather than disable features.
Registered users receive an expanded, formatted version of this documentation including selected Newt sources, information about additional methods, an introduction to NewtonScript, and notification of imminent releases. I also welcome comments, suggestions and questions from unregistered users, and I will respond as time permits.
If after a few days of trial use, you find Newt useful and would like to continue using it with a clear conscience and have the additional benefits just mentioned, please stop procrastinating and register. I know this sounds like a pledge break for National Public Television/Radio, but that’s the kind of user participation and support that shareware deserves and needs. Now, back to our regular program: Newt — the next generation.
Newt Interface Guide
Installation
Newt.pkg and NewtNews.txt are provided together in compressed form. If you obtained these from AppleLink or America Online, the extraction should be automatic or straightforward. Otherwise, you need a tool that can extract the files from Stuffit 1.5, and possibly BinHex format. On the Macintosh, I would recommend Stuffit Expander 3.0.7, or CompactPro, probably available from your favorite online service or ftp archive. NewtNews.txt is a plain-text subset of the longer manual, and can be viewed using TeachText or your favorite word processor (BBEdit Lite is nice). Newt.pkg can be loaded into your Newton using Newton Connection Kit (NCK), assuming you have the appropriate serial cable, and adequate memory (>50K) available in your Newton. If you had already installed the original Newt (1.0), you may wish to remove it first.
I will experiment with distributing sample sources to registered users via email, i.e., stuffed and binhexed NCK documents containing Notepad method entries.
Quick Tour
• write a number into the input field to the right of Dist. tap Dist.
• write a number into the input field to the right of Deg. tap Deg.
• write a (small) number into the input field to the right of Times. tap Times.
• tap Newt? checkbox. tap it again.
• tap Erase. tap Home.
• tap overview dot and select an expression. maybe edit values for times, dist, deg. tap Eval.
• draw a picture that you like, tap Save (later check that filing category in Notepad).
• drag Newt to another location and Eval an expression again.
• select and Eval :fourNewts() from the popup list, then select and Eval another expression like :squiral(8,40)— this demonstrates broadcasting messages to multiple Newts.
• tap About, then tap Save before closing it (later check for registration form in Notepad).
Main View
filing bar
Newt uses the filing category for “newts” for Save in Main View, Define Method View, Print Results View, and About View. Newt does not currently provide a filing button or routing button; however, you can look at, reorganize, print, fax, beam etc. your saved newts within the Notepad application (“all the newts fit to print”). Newt “compiles” (i.e., makes an executable version of) methods found in the category, and notes errors (if any) in the Print Results View.
Erase
Newt erases drawing area, and remains with same position, heading and pen.
Home
Newt teleports to center, sets heading to 0 (“up”), preserving pen setting but without drawing.
Gestures in draw area
The gesture applies to the Newt closest to the start of the gesture.
• tap
Newt moves to location of pen using current Pen setting, preserving heading.
• line
Newt sets heading to orientation (mod 45 degrees) of line. If Newt is already headed in that direction, it draws a line of same length (rounded to mod 10) of your gesture.
• scrub
same as Erase
• drag (actually the “hilite” gesture)
Hold down on a Newt until you “hear a squeak and get a fat pen”. Then, drag to a new location before lifting pen. Newt moves to new location without drawing.
Pen
Newt sets pen thickness used in drawing (default: 1). 0 means Newt just moves (no line).
Newt?
If checked (default: yes), Newt appears with its tip at current x,y position, pointing in current direction, and “xor-ed” so that it does not interfere with drawing.
Print?
If checked (default: no), Newt pops up a Print Results View with results of your Eval. Error messages will also appear regardless of this setting.
Times
The value in this field (default: 0) can be used as a times variable in the Eval field. The Times button uses this value to create an iteration, e.g., if Times=4, Dist=40, Deg=90, tapping on Times tells Newt to :go(40) then :turn(90) 4 times, i.e., making a square — the NewtonScript is written to the Eval field where it is executed immediately (and you can edit it later if you like). Tap Deg to turn, then tap Times or Eval again to see what happens.
Dist
The value in this field (default: 0) can be used as a dist variable in the Eval field. The Dist button uses this value for distance, e.g., if Dist=20, tapping on Dist tells Newt to :go(20), moving 20 in the “forward” direction, i.e., along Newt’s current heading. This draws a line if Pen is non-zero. A negative value for dist just means go “backward”. To give you some idea of scale, Newt’s drawing area is roughly 228x228. Newt will clip at its drawing boundary.
Deg
The value in this field (default: 0) can be used as a deg variable in the Eval field. The Deg button uses this value for degrees, e.g., if Deg=90, tapping on Deg tells Newt to :turn(90), turning right by 90 degrees. A negative value just means turn left. Newt will “mod” your number to prevent dizziness.
Eval
This field can contain a short program in NewtonScript. Tap the Eval button to execute it. This can be filled in via handwriting (not recommended because of field size and syntactic punctuation), tapping Times, selecting expressions from the overview dot list, and using a floating keyboard. If you would like to be prompted about adding words and expressions, double-tap in Eval to get a standard alphaKeyboard (I would then recommend extra spaces around parentheses and commas to prevent spurious prompts); tap the keyboard icon for a keyboard without the prompts.
You can also use the variable names times, dist and deg, so if you edit those values you can just Eval your same expression again. The Eval button remains highlighted during execution. During interruptible methods, e.g., squiral2, it changes to Stop and you can tap it to terminate execution. If you spell something incorrectly, or use incorrect syntax or parameters, you will most likely see the Print Results View (or a system error box) with a somewhat cryptic error message or code. Basically, you’ll have to take a closer look at what you wrote, take a look at the additional NewtonScript documentation (see Newton Script) or error codes (see Errors), edit it and try again
WARNING: I DO NOT PROVIDE A GENERAL INTERRUPT CAPABILITY (BEYOND THE MANUAL RESET BUTTON IN THE BACK). I SUGGEST COMMON SENSE IN CHOOSING VALUES FOR ITERATION, RECURSION OR DISTANCE THAT ARE NOT “TOO LARGE”. I will generally provide some reasonable values to try. There is a way to rewrite methods to be interruptible, but that’s an advanced topic.
About
A popup window appears. If you tap Save, Newt saves a registration form in Notepad.
keyboard icon
This toggles (either shows or hides) a floating keyboard that does not prompt for additions to the dictionary. You can double-tap in the Eval field for the standard keyboard that does.
Save
What gets saved depends on which view is on top. See also: Define Method View, Print Results View, and About View. For Main View, if there is a drawing, Newt saves a “newt” (note) to Notepad containing the current drawing.
overview dot
A popup list of sample expressions appears. If you select an expression, it is copied to the Eval field. You can then edit it, and/or tap Eval to execute. Registered users can customize this list.
scroll up, scroll down arrows
What scrolls depends on which view is on top. In Main View, the Define Method View scrolls into view. In Define Method View and Print Results View, the main text field scrolls.
Preferences
Newt saves your preferences for Pen, Newt? and Print? in a “system soup” frame so that it can potentially persist across Newt sessions. Since Newt is a neat newt, this preferences entry is removed if you remove the Newt application, replace it with a newer version, or remove the card Newt is on. Registered users receive information on how to copy any Newt 1.0 sources that were saved in Preferences to the NotePad.
Define Method View
overview dot
A popup menu appears with methods defined in current filing category (see filing bar). You can also select New at the top of the menu to create a default template.
code list
As you select items from the text list on the right, a template is inserted into your current method. This list can be customized by registered users.
edit area
You can use handwriting, the keyboard icon (or double-tap for the regular, dictionary prompting keyboard), and code list to edit your method. The only format requirement is that the method name occur on the first line, and be followed immediately on the next line by func. For example, here is source for an implementation of poly:
poly
func (nsides,len)
// make a polygon of <nsides>
// each side is <len> length
// this computes angle <ang>
if nsides=0
then :beep ()
else begin
local i,ang := 360/nsides;
for i:=1 to nsides
:go (len); :turn (ang);
end
To define your own method, you might try something simple like:
fd
func(distance)
// forward
:go(distance)
You could then invoke this method in the Eval field, e.g., :fd(80)
Revert
If you have unsaved changes, Revert appears (and the close box disappears). Tap it to return to the last version saved of the original method, or for New, to the basic template.
Save
Assuming that the method name is valid, does not conflict with a pre-defined “system” method, and successfully compiles, the method source is saved (created or updated) as a “newt” (i.e., text Note) in the current filing category. Errors, if any, are noted in the Print Results View. I decided that Newt should save only valid sources. So, if you cannot figure out a compile error from the cryptic message, you could either Revert to the earlier version, or comment out offending code (precede individual lines with //, or wrap a section with /* <lines of code> */), so that you can Save for now, get on with your life, and look at it later.
close box
If you have unsaved changes, the close box disappears. It reappears after Revert or a successful Save. Then you can exit normally.
Print Results View
See earlier comments under filing bar, scroll up, down arrows, and Save.
About View
See earlier comments under filing bar and Save.
NewtonScript
Syntax
If you have already tried out the examples outlined in the earlier Interface Quick Tour, tapped on the overview dot examples, and looked at the earlier poly example, then you should have a rough idea of what the NewtonScript (NS) syntax is like and several of Newt’s commands. In NS, programs or scripts are defined as “methods” on objects. Methods describe an object’s behavior or actions. Objects in NS are called “frames” (perhaps they should have been called “newtrons”), which “inherit” attributes and behavior from other frames, usually called “prototypes”. Newt is a prototype or kind of view. You tell Newt to do things by sending it a “message”, e.g., go. This message consists of a frame (Newt implicitly), a colon (:) separator, the method name, and parentheses with zero or more parameters (values for variables) separated by commas. For example, :go(50). A frame also has “slots” (named attributes) that contain values that you can access, such as times, dist, and deg. You can just use the slot name if it can be found via inheritance, or frame.slot if you want to be more specific.
WARNING: IF YOU USE OTHER SYSTEM FRAMES, METHODS, AND FUNCTIONS BEYOND THE ONES I HAVE DESCRIBED HERE, YOU DO SO AT YOUR OWN RISK.
For further information on NewtonScript syntax, and view frame slots and methods, NTK from APDA includes manuals, and hopefully there will be additional books published soon. The Newt Manual provides a summary of syntax and additional Newt methods for registered users.
Errors
In the unlikely event that a system box pops up with a cryptic error code during Eval or Save, check the following partial list of common error codes, and see if there might be something missing or extra in one of your values or expressions.
Common Error Codes
Code Description
-8007 syntax error (from compiler)
-48404 expected a number
-48402 expected an integer
-48803 wrong number of arguments
-48807 undefined variable
-48809 undefined method
1627052 divide by zero
If you have a Macintosh, you might want to get the Newton LowDown DA (available online) which provides a more complete list of errors from the NTK docs.
Things to try: check your syntax against those in examples, check spelling for method and variable names, missing or extra punctuation, garbage from stray gestures, check number and type of arguments (e.g., float vs. integer), and in general use your “newtle”. If you think it’s really a problem with Newt, send me mail describing what you had entered, and I'll try to respond asap.
Newt Methods
These methods can be invoked without an explicit frame, e.g., :go(50), which means send the message to the default Newt, or if you have multiple Newts, it means broadcast to all of the Newts. Here are a few of Newt's methods:
:erase()
Newt erases its drawing area
:go(distance)
Newt moves distance from current location, forward if distance is positive, backward if negative. If Pen is a number, Newt draws a line. Newt just clips the line and disappears if you command it to go outside.
:home()
Newt moves to center, heads up, ignoring but preserving current pen setting.
:pendown()
sets Newt’s pen down.
:penup()
sets Newt’s pen up.
:poly(sides,len)
Newt draws a polygon, e.g., :poly(6,50) is a hexagon. :poly(times,dist) uses the edit fields. A sample source was provided as an example under Define Method View.
:turn(degrees)
Newt turns degrees relative to current heading: if positive, turns Newt to right, negative to left.
Possible Next Steps
There are many features and fixes that would be nice to have. However, there are also design trade-offs, especially given the MessagePad’s and my constraints. So, help me figure out:
• where can it go on the screen?
• is it worth the extra memory space or implementation time?
• can it take advantage of existing Newton mechanisms or metaphors?
For example:
• online help (on Mac as a FrameViewer or DocViewer file; on Newton as a “book”)?
• add filing and routing buttons?
• better drag gesture; other gestures for drawing; undo support for drawing?
• distinguish multiple Newts (by sound, shading, eventually by color)?
• a subset of string/list Logo-equivalent commands (I have an initial version that I can make available as an NCK file)?
• allow more customization of Newt environment, save more to Preferences?
• more tutorial information, examples?
Personal History
I first implemented a screen turtle on an IMLAC display computer, accessed from BBN Logo on a DEC PDP-10 at Stanford circa 1973. Subsequently, I implemented other versions in Lisp, and used others in Smalltalk and ObjectLogo. My long-time interests in children, learning and programming, plus two small NTK examples, Dot2Dot and InspectorGadget, with a little creative juxtaposition, started me down this path. When I am not working on Newt at home or trying to have a life, I am consulting, currently for pharmaceutical companies, on “enabling technologies”, in particular, pen-based systems.
Credits
Newt 1.1 was created with NTK 1.0b6. Newton and Newton ToolKit are trademarks of Apple Computer. Apple deserves credit for creating an exciting product (Newton), and powerful object-oriented language (NewtonScript) and development environment (NTK). I look forward to new versions of NTK, documentation and examples.
My family contributed the evening and weekend time for me to explore this; Ellie and Kristina helped with testing, Maria with proofreading.
Finally, thanks to the early users who have given me feedback and encouragement. I hope that Newt can continue to evolve into an environment that meets your needs.